#define _CRT_SECURE_NO_WARNINGS 1
#include"TBS.h"

int cnt = 1;
Station stn;

BuyInfo buy = { 0 };

void start()
{
	int input = 0;
	while (1)
	{
		if (cnt != 1)
		{
			printf("\n\t\t\t------------------------System Notice------------------------\n");
			printf("\t\t\t[---------------This system run for the %d time--------------\n", cnt);
			printf("\t\t\t-------------------------------------------------------------\n\n");
		}
		input = Menu();
		switch (input)
		{
		case 1:
			TicketSelling(&stn, &buy);
			cnt++;
			break;
		case 2:
			SystemManage(&stn, &buy);
			cnt++;
			break;
		case 3:
			ExitProgram(&stn);
			cnt++;
			break;
		default:
			printf("Invalid input!\n");
			break;
		}
	}

}

int main()
{
	printf("\t\t\t                        @BuiDer 2024\n\n");
	printf("\t\t\t*************************************************************\n");
	printf("\t\t\t             Welcome to use Train Booking System!          \n");
	printf("\t\t\t*************************************************************\n\n");

	InitialData(&stn);

	if (cnt == 1)
	{
		printf("\n\t\t\t------------------------System Notice------------------------\n");
		printf("\t\t\t[This program runs for the first time, please add the station \n\t\t\tand the corresponding ticket information.]\n");
		printf("\t\t\t-------------------------------------------------------------\n\n\n");
	}

	start();

	return 0;
}